using System.Collections.Generic;
using System.Text.Json.Serialization;
using JlPay.Sdk.Models;
using JlPay.Sdk.Services;

namespace JlPay.Sdk.Models.Openmerch.Change
{
    /// <summary>
    /// 结算规则修改请求
    /// </summary>
    public class SettleRuleModifyRequest : OrgBaseRequest, IRequestMapper
    {
        /// <summary>
        /// API URL
        /// </summary>
        public const string API_URL = "/open/merch/access/settle-rule/modify";

        /// <summary>
        /// 申请单id
        /// </summary>
        [JsonPropertyName("apply_id")]
        public string ApplyId { get; set; } = string.Empty;

        /// <summary>
        /// 结算方式
        /// </summary>
        [JsonPropertyName("settle_mode")]
        public string SettleMode { get; set; } = string.Empty;

        /// <summary>
        /// 营业周期，结算日切时间
        /// </summary>
        [JsonPropertyName("day_cut")]
        public string DayCut { get; set; } = string.Empty;

        /// <summary>
        /// 结算场次
        /// </summary>
        [JsonPropertyName("settle_session")]
        public string SettleSession { get; set; } = string.Empty;

        /// <summary>
        /// 是否允许商户自主变更结算账户，0-否1-是
        /// </summary>
        [JsonPropertyName("account_change_flag")]
        public string AccountChangeFlag { get; set; } = string.Empty;

        /// <summary>
        /// 结算附言
        /// </summary>
        [JsonPropertyName("postscript")]
        public string Postscript { get; set; } = string.Empty;

        /// <summary>
        /// 构造函数
        /// </summary>
        public SettleRuleModifyRequest()
        {
        }

        /// <summary>
        /// 转换为字典
        /// </summary>
        /// <returns>字典对象</returns>
        public Dictionary<string, object> ToMap()
        {
            var map = new Dictionary<string, object>();

            // 添加基础字段
            if (!string.IsNullOrEmpty(OrgNo))
                map["org_no"] = OrgNo;
            if (!string.IsNullOrEmpty(MerchNo))
                map["merch_no"] = MerchNo;
            if (!string.IsNullOrEmpty(ApplyId))
                map["apply_id"] = ApplyId;
            if (!string.IsNullOrEmpty(SettleMode))
                map["settle_mode"] = SettleMode;
            if (!string.IsNullOrEmpty(DayCut))
                map["day_cut"] = DayCut;
            if (!string.IsNullOrEmpty(SettleSession))
                map["settle_session"] = SettleSession;
            if (!string.IsNullOrEmpty(AccountChangeFlag))
                map["account_change_flag"] = AccountChangeFlag;
            if (!string.IsNullOrEmpty(Postscript))
                map["postscript"] = Postscript;

            return map;
        }
    }
} 